// pages/mine/mine.js
var app = getApp()
Page({
  data: {
    motto: 'Hello everyone',
    result:'',
    userInfo: {}
  },
  onLoad: function () {
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
    });
  },
  userNameInput:function(e)
  {
      this.setData({
      userName: e.detail.value
  })
  },
  loginBtnClick: function (e) {
    console.log("星座："+this.data.userName);
    wx.request({
      url:`http://api.avatardata.cn/Constellation/Query?key=c16012b1658942afb9e1071fd18a8d62&consName=${this.data.userName}&type=today`,
      header: { 'content-type': 'application/json' },
      method: 'GET',
      dataType:'json',
      responseType:'text',
      success:(res)=>{
        this.setData({
        result:res.data
      })
      }
    });
  }
})